<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath }"/>
<%@taglib  prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title>低值资产管理系统</title>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta content="width=device-width, initial-scale=1.0" name="viewport" />
	<meta content="" name="description" />
	<meta content="" name="author" />
	<meta name="MobileOptimized" content="320">
	<!-- BEGIN GLOBAL MANDATORY STYLES -->          
	<link href="${ctx}/assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>
	<!-- END GLOBAL MANDATORY STYLES -->
	<!-- BEGIN THEME STYLES --> 
	<link href="${ctx}/assets/css/style-metronic.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/style.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/style-responsive.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/plugins.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/themes/light.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/custom.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx }/assets/plugins/jquery-file-upload/css/jquery.fileupload-ui.css" rel="stylesheet" />
	<link rel="stylesheet" type="text/css" href="${ctx}/assets/plugins/bootstrap-daterangepicker/daterangepicker-bs3.css" />
	<link rel="stylesheet" type="text/css" href="${ctx}/assets/plugins/bootstrap-datetimepicker/css/datetimepicker.css" />
	<link rel="stylesheet" type="text/css" href="${ctx}/assets/plugins/jquery-multi-select/css/multi-select.css" />
	<link href="${ctx }/css/custom.css" rel="stylesheet" type="text/css"/>

	<link href="${ctx}/frontend/assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
   
   	<link href="${ctx}/frontend/assets/css/pages/portfolio.css" rel="stylesheet" type="text/css"/>

	<link href="${ctx}/frontend/assets/plugins/fancybox/source/jquery.fancybox.css" rel="stylesheet" />              
    <link rel="stylesheet" href="${ctx}/frontend/assets/plugins/revolution_slider/css/rs-style.css" media="screen">
    <link rel="stylesheet" href="${ctx}/frontend/assets/plugins/revolution_slider/rs-plugin/css/settings.css" media="screen"> 
    <link href="${ctx}/frontend/assets/plugins/bxslider/jquery.bxslider.css" rel="stylesheet" />       
	<!-- END THEME STYLES -->	
	<link rel="shortcut icon" href="favicon.ico" />
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body class="page-header-fixed page-full-width">
	<!-- BEGIN HEADER -->   
	<%@include file="../include/header.jsp" %>
	<!-- END HEADER -->
	
	<!-- BEGIN CONTAINER -->
	<div class="page-container">
		<div class="page-content">
			
			<!-- END BEGIN STYLE CUSTOMIZER -->            
			<!-- BEGIN PAGE HEADER-->
			<div class="row">
				<div class="col-md-12">
					<!-- BEGIN PAGE TITLE & BREADCRUMB-->
					<h3 class="page-title">
						物资详情
					</h3>
					
					<!-- END PAGE TITLE & BREADCRUMB-->
				</div>
			</div>
			<!-- END PAGE HEADER-->
			<!-- BEGIN PAGE CONTENT-->          
			<div class="row">
				<div class="col-md-12">
					
					<!-- BEGIN SAMPLE TABLE PORTLET-->
					<div class="portlet box green">
						<div class="portlet-title">
							<div class="caption"><i class="fa fa-cogs"></i>物资详细信息</div>
							<div class="tools">
								<a href="javascript:;" class="collapse"></a>
							</div>
						</div>
						<div class="portlet-body flip-scroll">
							<div style="text-align:right;">
								<a class="btn blue" id="xiuGaiAN"><i class="fa fa-search"></i>&nbsp;&nbsp;确认</a>&nbsp;&nbsp;
								<a class="btn default" onclick="window.close()"><i class="fa fa-search"></i>&nbsp;&nbsp;关闭</a>
							</div>
							<div class="row">
								<div class="col-md-6">
									<form class="form-horizontal" role="form">
										<div class="form-group">
											<label class="col-md-4 control-label">购买日期</label>
											<label class="col-md-8 control-label" style="text-align:left;"><fmt:formatDate value="${wuZi.gouMaiRQ }" pattern="yyyy-MM-dd"/></label>
										</div>
										<div class="form-group">
											<label class="col-md-4 control-label">资产编号</label>
											<label class="col-md-8 control-label" style="text-align:left;">${wuZi.ziChanBH }</label>
										</div>
										<div class="form-group">
											<label class="col-md-4 control-label">物料编码</label>
											<label class="col-md-8 control-label" style="text-align:left;">${wuZi.wuLiaoBM }</label>
										</div>
										<div class="form-group">
											<label class="col-md-4 control-label">使用部门</label>
											<label class="col-md-8 control-label" style="text-align:left;">${wuZi.dep.depName }</label>
										</div>
										<div class="form-group">
											<label class="col-md-4 control-label">使用人</label>
											<label class="col-md-8 control-label" style="text-align:left;">${wuZi.user.name }</label>
										</div>
										<div class="form-group">
											<label class="col-md-4 control-label">增加方式</label>
											<label class="col-md-8 control-label" style="text-align:left;">${wuZi.zengJiaFS }</label>
										</div>
										<div class="form-group">
											<label class="col-md-4 control-label">入库日期</label>
											<label class="col-md-8 control-label" style="text-align:left;"><fmt:formatDate value="${wuZi.ruKuRQ }" pattern="yyyy-MM-dd"/></label>
										</div>
										<div class="form-group">
											<label class="col-md-4 control-label">开始使用日期</label>
											<label class="col-md-8 control-label" style="text-align:left;"><fmt:formatDate value="${wuZi.chuKuRQ }" pattern="yyyy-MM-dd"/></label>
										</div>
										<div class="form-group">
											<label class="col-md-4 control-label">使用状态</label>
											<label class="col-md-8 control-label" style="text-align:left;">${wuZi.shiYongZT.zhangTaiMC }</label>
										</div>
										<div class="form-group">
											<label class="col-md-4 control-label">物资类型</label>
											<label class="col-md-8 control-label" style="text-align:left;">
												<c:choose>
													<c:when test="${wuZi.wuZiLX==1 }">
														低值资产
													</c:when>
													<c:when test="${wuZi.wuZiLX==2 }">
														低值易耗品
													</c:when>
												</c:choose>
											</label>
										</div>
										<div class="form-group">
											<label class="col-md-4 control-label">物资类别</label>
											<label class="col-md-8 control-label" style="text-align:left;">${wuZi.wuZiLB.leibieMC }</label>
										</div>
									</form>
								</div>
								<div class="col-md-5 front-carousel" style="margin-top:30px;">
									<div id="myCarousel" class="carousel slide">
										<!-- Carousel items -->
										<div class="carousel-inner">
											<c:forEach items="${wuZi.tuPians }" var="u" varStatus="id">
												<c:choose>
													<c:when test="${id.index==0 }">
														<div class="active item">
															<img src="${ctx }${u.xiangDuiLJ}/${u.wenJianM}" alt="">												
														</div>
													</c:when>
													<c:otherwise>
														<div class="item">
															<img src="${ctx }${u.xiangDuiLJ}/${u.wenJianM}" alt="">												
														</div>
													</c:otherwise>
												</c:choose>
											</c:forEach>
										</div>
										<!-- Carousel nav -->
										<a class="carousel-control left" href="#myCarousel" data-slide="prev">
											<i class="fa fa-angle-left"></i>
										</a>
										<a class="carousel-control right" href="#myCarousel" data-slide="next">
											<i class="fa fa-angle-right"></i>
										</a>
									</div>
								</div>
							</div>
							<form class="form-horizontal" method="POST" action="" id="wuZiForm" role="form">
								<input type="hidden" name="id" value="${wuZi.id }">
								<input type="hidden" name="shenQingId" value="${shenQingId }">
								<div class="col-md-12">
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">资产编码(财务)</label>
											<div class="col-md-4">
												<input type="text" class="form-control" value="${wuZi.ziChanBM }" name="ziChanBM" placeholder="资产编码">
											</div>
											<label class="col-md-2 control-label">开始计提日期</label>											
											<div class="col-md-4">
												<div class="input-group input-medium date date-picker" data-date-format="yyyy-mm-dd">
													<input type="text" class="form-control" name="kaiShiJiTiRQStr" value="${dangQianRQ }" readonly>
													<span class="input-group-btn">
													<button class="btn default" type="button"><i class="fa fa-calendar"></i></button>
													</span>
												</div>
											</div>
										</div>
									</div>
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">物资名称</label>
											<div class="col-md-4">
												<input type="text" class="form-control" value="${wuZi.wuZiMC }" name="wuZiMC" placeholder="物资名称">
											</div>
											<label class="col-md-2 control-label">物资品牌</label>
											<div class="col-md-4">
												<input type="text" class="form-control" value="${wuZi.pinPai }" name="pinPai" placeholder="物资品牌">
											</div>
										</div>
									</div>
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">规格型号</label>
											<div class="col-md-4">
												<input type="text" class="form-control" value="${wuZi.guiGeXH }" name="guiGeXH" placeholder="规格型号">
											</div>

											<%--<label class="col-md-2 control-label">产品序列号</label>
											<div class="col-md-4">
												<input type="text" class="form-control" value="${wuZi.chanPinXLH }" name="chanPinXLH" placeholder="产品序列号">
											</div>--%>

										</div>
									</div>
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">物资原值</label>
											<div class="col-md-2">
												<input type="text" class="form-control" value="${wuZi.wuZiYZ }" name="wuZiYZ" placeholder="物资原值">
											</div>
											<label class="col-md-2 control-label" style="text-align:left;">${wuZi.biZhong.biZhongMC }</label>
											
											<%--<label class="col-md-2 control-label">预计净残值率</label>
											<div class="col-md-2">
												<input type="text" class="form-control" value="${wuZi.jingCanZhiLv }" name="jingCanZhiLv" placeholder="预计净残值率">
											</div>
											<label class="col-md-1 control-label" style="text-align:left;">%</label>--%>
										</div>
									</div>
									<div class="row">
										<div class="form-group">
											<%--<label class="col-md-2 control-label">物资净值</label>
											<div class="col-md-2">
												<input type="text" class="form-control" value="${wuZi.wuZiJingZhi }" name="wuZiJingZhi" placeholder="物资净值">
											</div>--%>
											<label class="col-md-2 control-label">管理部门</label>
											<div class="col-md-4">
												<select name="guanLiBMId" id="guanLiBMId" class="form-control">
													<option value="">请选择...</option>
													<c:forEach items="${depList }" var="u">
														<option value="${u.id }"><c:forEach var="item" varStatus="status" begin="1" end="${u.cengJi}">&nbsp;&nbsp;&nbsp;&nbsp;</c:forEach>${u.depName }</option>
													</c:forEach>
												</select>
											</div>
										</div>
									</div>
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">生产厂家</label>
											<div class="col-md-8">
												<input type="text" class="form-control" value="${wuZi.shengChanCJ }" name="shengChanCJ" placeholder="生产厂家">
											</div>
										</div>
									</div>
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">供应商名称</label>
											<div class="col-md-8">
												<input type="text" class="form-control" value="${wuZi.gongYingShangMC }" name="gongYingShangMC" placeholder="供应商名称">
											</div>
										</div>
									</div>
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">保修截止日期</label>
											<div class="col-md-4">
												<div class="input-group input-medium date date-picker" data-date-format="yyyy-mm-dd">
													<input type="text" class="form-control" name="baoXiuJZRQStr" value="<fmt:formatDate value="${wuZi.baoXiuJZRQ }" pattern="yyyy-MM-dd"/>" readonly>
													<span class="input-group-btn">
													<button class="btn default" type="button"><i class="fa fa-calendar"></i></button>
													</span>
												</div>
											</div>
										</div>
									</div>
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label"> 备注</label>
											<div class="col-md-8">
												<input type="text" class="form-control" value="${wuZi.beiZhu }" name="beiZhu" placeholder="备注">
											</div>
										</div>
									</div>					
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">存放地点</label>
											<div class="col-md-8">
												<input type="text" class="form-control" value="${wuZi.cunFangD }" name="cunFangD" placeholder="存放地点">
											</div>
										</div>
									</div>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>			
			<!-- END PAGE CONTENT-->
		</div>
		<!-- END PAGE -->
	</div>
	<!-- END CONTAINER -->
	<!-- BEGIN FOOTER -->
	<%@include file="../include/footer.jsp" %>
	<!-- END FOOTER -->
	<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
	<!-- BEGIN CORE PLUGINS -->   
	<!--[if lt IE 9]>
	<script src="${ctx}/assets/plugins/respond.min.js"></script>
	<script src="${ctx}/assets/plugins/excanvas.min.js"></script> 
	<![endif]-->   
	<script src="${ctx}/assets/plugins/jquery-1.10.2.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>    
	<script src="${ctx}/assets/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/bootstrap-hover-dropdown/twitter-bootstrap-hover-dropdown.min.js" type="text/javascript" ></script>
	<script src="${ctx}/assets/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/jquery.blockui.min.js" type="text/javascript"></script>  
	<script src="${ctx}/assets/plugins/jquery.cookie.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/uniform/jquery.uniform.min.js" type="text/javascript" ></script>
	<script src="${ctx}/assets/scripts/form-components.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-datepicker/js/locales/bootstrap-datepicker.zh-CN.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/clockface/js/clockface.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-daterangepicker/moment.min.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-daterangepicker/daterangepicker.js"></script>
	<script type="text/javascript" src="${ctx}/frontend/assets/plugins/revolution_slider/rs-plugin/js/jquery.themepunch.plugins.min.js"></script>
    <script type="text/javascript" src="${ctx}/frontend/assets/plugins/revolution_slider/rs-plugin/js/jquery.themepunch.revolution.min.js"></script> 
    <script type="text/javascript" src="${ctx}/frontend/assets/plugins/bxslider/jquery.bxslider.min.js"></script>    
    <script src="${ctx}/assets/plugins/jquery-validation/dist/jquery.validate.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="${ctx }/assets/plugins/jquery.input-ip-address-control-1.0.min.js"></script>
    <script type="text/javascript" src="${ctx }/assets/plugins/jquery-multi-select/js/jquery.multi-select.js"></script>
    <script type="text/javascript" src="${ctx }/assets/plugins/jquery-inputmask/jquery.inputmask.bundle.min.js"></script>
    <script type="text/javascript" src="${ctx}/assets/plugins/select2/select2.min.js"></script>
    <script type="text/javascript" src="${ctx}/assets/plugins/fuelux/js/spinner.min.js"></script>
    <script src="${ctx}/assets/plugins/bootstrap-touchspin/bootstrap.touchspin.js" type="text/javascript"></script>
    <script src="${ctx }/assets/plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript" ></script>
    
    <script src="${ctx }/assets/plugins/jquery-file-upload/js/vendor/jquery.ui.widget.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/vendor/tmpl.min.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/vendor/load-image.min.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/vendor/canvas-to-blob.min.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.iframe-transport.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload-process.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload-image.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload-audio.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload-video.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload-validate.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload-ui.js"></script>
	
    <script src="${ctx}/frontend/assets/scripts/index.js"></script>
	<!-- END CORE PLUGINS -->
	<script src="${ctx}/assets/scripts/app.js"></script>
	
	<script src="${ctx }/js/form-fileupload.js"></script>	
	<script>
		var fileType=0;
		
		jQuery(document).ready(function() {       
		   // initiate layout and plugins
		   App.init();
		   FormComponents.init();		   
		   $('#guanLiBMId').attr('value','${wuZi.guanLiBM.id}');
		   fileType=0;
		   $.ajax({
				type:"POST",
				url:"${ctx}/wuzi/displayTuPian.do",
				dataType:"html",
				data:{
					"wuZiId":"${wuZi.id}"
				},
				success:function(data){											
					$('#tuPianList').html(data);
				}
			});
		});
		
		function validateForm() {
			//validate方法参数可选  
			return $("#wuZiForm").validate({
				errorElement: 'span', //default input error message container
	            errorClass: 'help-block', // default input error message class
	            focusInvalid: false, // do not focus the last invalid input
				rules : {
					wuZiYZ : {
						required : true,
						number : true
					},
					zheJiuYX : {
						required : true,
						digits : true
					},
					baoFeiYX : {
						required : true,
						digits : true
					},
					zheJiuYS : {
						required : true,
						digits : true
					},
					jingCanZhiLv : {
						required : true,
						number : true
					},
					ziChanBM : {
						required: true
					}
				},
				messages : {
					wuZiYZ : {
						required : '请输入物资原值',
						number : '请输入数值'
					},
					ziChanBM : {
						required:'请输入资产编码（财务）'
					}
				},
				
				errorPlacement: function(error, element) {  
				    error.appendTo(element.parent());  
				}
			}).form();			
		}
		
		$('#xiuGaiAN').bind('click',function(){
			if(validateForm()){
				$.ajax({
					type:"POST",
					data:$('#wuZiForm').serialize(),
					url:"${ctx}/wuzi/caiGouCWQRSave.do",
					dataType:"json",
					async:false,
					success:function(data){
						if(data.result=="success"){
							alert("资产编码已经登记");
							$.ajax({
								type:"POST",
								url:"${ctx}/wuzi/cwysList.do",
								dataType:"html",
								success:function(data){											
									window.opener.document.getElementById("cwys").innerHTML = data;
									window.close();
								}
							});
						}
					}
				});
			}
		});
	</script>
</body>
<!-- END BODY -->
</html>